package com.woniuxy.credit_loans.product_liu.service.impl;

import com.woniuxy.credit_loans.entity.ProductRecord;
import com.woniuxy.credit_loans.mapper.ProductRecordMapper;
import com.woniuxy.credit_loans.product_liu.dto.ProductRecordDto;
import com.woniuxy.credit_loans.product_liu.service.ProductRecordService;
import com.woniuxy.credit_loans.product_liu.vo.ProductRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class ProductRecordServiceImpl implements ProductRecordService {
    @Autowired
    private ProductRecordMapper productRecordMapper;


    @Override
    public int updateByPrimaryKeySelective(ProductRecord record) {
        return productRecordMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<ProductRecordVo> selectAllRecords() {
        return productRecordMapper.selectAllRecords();
    }

    @Override
    public int insertProductRecord(ProductRecordDto productApprovalDto) {
        productApprovalDto.setProductrecordApproveDate(new Date());
        productApprovalDto.setIsShow("1");
        return productRecordMapper.insertProductRecord(productApprovalDto);
    }
}
